package com.fan.txl.ui.adapter;

import android.view.View;
import com.base.txl.utils.ComponentUtils;
import com.fan.txl.R;
import com.fan.txl.data.Friend;
import com.fan.txl.BR;
import com.fan.txl.listener.OnClick;
import com.fan.txl.databinding.ActivityFriendsItemBinding;
import com.fan.txl.ui.FriendUI;
import com.fan.txl.ui.routers.ComponentRouters;
import java.util.List;

/**
 * Created by jiajiabao on 17-1-10.
 */

public class FriendsBindAdapt extends BindAdapt<Friend> implements OnClick{

    @Override
    public int getLayoutId(int viewType) {
        return R.layout.activity_friends_item;
    }

    @Override
    public int getVariableId() {
        return BR.friend;
    }

    @Override
    public void onDataBind(BindingVHolder holder, int position) {
        
       /* TextView text = (TextView) findViewById(R.id.demoText);
        Bypass bypass = new Bypass();
        String markdownString = "#Markdown!";
        CharSequence string = bypass.markdownToSpannable(markdownString);
        text.setText(string);
        text.setMovementMethod(LinkMovementMethod.getInstance());*/

        ActivityFriendsItemBinding binding=(ActivityFriendsItemBinding) holder.getBinding();
        binding.setOnClick(this);
    }


    public FriendsBindAdapt(List<Friend> data) {
        super(data);
    }

    @Override
    public void click(View view) {
        Friend  friend= (Friend)view.getTag();
        ComponentUtils.start(view.getContext(), FriendUI.class,friend);
    }


}
